// FireDemoDlg.h : Header-Datei
//

#define MAXCAMERAVIEWS 3

#if !defined(AFX_FIREDEMODLG_H__9E0246EF_13DD_4D9A_8FEE_DC236957FFA1__INCLUDED_)
#define AFX_FIREDEMODLG_H__9E0246EF_13DD_4D9A_8FEE_DC236957FFA1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "resource.h"
#include "Afxmt.h"
#include <fgcamera.h>

#define MAXMSGLENGTH                    128             // Max. logmsglength
#define MAXMSGSINFLIGHT                 16              // Max. messages in flight

#define WM_LOGMSG                       (WM_APP+0)      // Log message
#define WM_FGNOTIFY                     (WM_APP+1)      // Notify from grabber
#define WM_NEWFRAME                     (WM_APP+2)      // Message to camera frame
#define WM_SELECTION                    (WM_APP+3)      // Selection in view

class CCameraFrame;

typedef struct
{
  BOOL          LimitSpeed;                             // Limit speed
  BOOL          Busy;                                   // Busy status
  UINT32HL      Guid;                                   // GUID for this camera
  UINT8         NodeId;                                 // ID of this node
  char          DeviceName[128];                        // Name of device
  CCameraFrame *pCameraFrame;                           // Pointer to camera frame
}CAMERAINFO;

/////////////////////////////////////////////////////////////////////////////
// CDlgNodeList Dialogfeld

class CDlgNodeList : public CDialog
{
protected:
        DWORD           m_MsgCnt;
        BOOL            m_LogEnabled;
        long            m_Memory;
        DWORD           m_MsgsInFlight;
        BOOL            m_MsgOverflow;

        CCriticalSection m_CriticalSection;

        void            GetDisplayName(CAMERAINFO *pCameraInfo,char *pBuf);

        void            OnNodelistChanged();
        void            AddNode(FGNODEINFO *pInfo);
        void            RemoveNode(UINT32 Ix);
        void            EnableNode(UINT32 Ix,BOOL Enable);
        void            OnFramesReady(CAMERAINFO *pCameraInfo);

public:
                        CDlgNodeList(CWnd* pParent = NULL);

        void            LogMessage(char* pMsg,DWORD lParam=0);
        void            LogResult(char* pFunction,DWORD Result);
        void            CheckResult(char* pFunction,DWORD Result);

        void            LogDWORD(char* pName,DWORD Value,BOOL Hex=TRUE);
        void            ReportMemoryUsage(long Memory);
        void            OnFrameClosing(CAMERAINFO *pCameraInfo);

// Dialogfelddaten
	//{{AFX_DATA(CDlgNodeList)
	enum { IDD = IDD_NODELIST_DIALOG };
	//}}AFX_DATA

	//{{AFX_VIRTUAL(CDlgNodeList)
	public:
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);
	//}}AFX_VIRTUAL

// Implementierung
protected:
	HICON m_hIcon;

	//{{AFX_MSG(CDlgNodeList)
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnClearLog();
	afx_msg void OnClose();
	afx_msg void OnDetail();
	afx_msg void OnConnect();
	afx_msg void OnDblclkDevices();
	afx_msg LRESULT OnLogMsg(WPARAM,LPARAM);
	afx_msg LRESULT OnFgNotify(WPARAM,LPARAM);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
        afx_msg void OnBnClickedLicense();
protected:
        virtual void OnOK();
        virtual void OnCancel();
};

//{{AFX_INSERT_LOCATION}}

// Declare pointer to our dialog
extern CDlgNodeList *pDlgNodeList;

#endif // !defined(AFX_FIREDEMODLG_H__9E0246EF_13DD_4D9A_8FEE_DC236957FFA1__INCLUDED_)

